#include<graphics.h>
#include<conio.h>
#include<math.h>

#define high 480
#define width 640
#define Pi 3.14159
int main()
{
	initgraph(width, high);

	int center_x, center_y;
	center_y = high / 2;
	center_x = width / 2;

	int SecondLength;
	SecondLength = width / 5;
	int SecondLength1;
	SecondLength1 = width / 6;
	int SecondLength2;
	SecondLength2 = width / 8;

	int SecondEnd_x, SecondEnd_y;
	int SecondEnd_x1, SecondEnd_y1;
	int SecondEnd_x2, SecondEnd_y2;

	
	float SecondAngel=0;
	float SecondAngel1 = 0;
	float SecondAngel2 = 0;
	SYSTEMTIME ti;

	BeginBatchDraw();
	while (1)
	{
		GetLocalTime(&ti);

		SecondAngel = ti.wSecond * 2 * Pi / 60;
		SecondEnd_x = center_x + SecondLength * sin(SecondAngel);
		SecondEnd_y = center_y - SecondLength * cos(SecondAngel);
		SecondAngel1 = ti.wMinute * 2 * Pi / 60;
		SecondEnd_x1 = center_x + SecondLength1 * sin(SecondAngel1);
		SecondEnd_y1 = center_y - SecondLength1 * cos(SecondAngel1);
		SecondAngel2 = ti.wHour * 2 * Pi / 12 + ti.wMinute / 60 * 2 * Pi / 12;
		SecondEnd_x2 = center_x + SecondLength2 * sin(SecondAngel2);
		SecondEnd_y2 = center_y - SecondLength2 * cos(SecondAngel2);

		setlinestyle(PS_SOLID, 2);
		setcolor(WHITE);
		line(center_x, center_y, SecondEnd_x, SecondEnd_y);
		setlinestyle(PS_SOLID, 2);
		setcolor(BLUE);
		line(center_x, center_y, SecondEnd_x1, SecondEnd_y1);
		setlinestyle(PS_SOLID, 5);
		setcolor(RED);
		line(center_x, center_y, SecondEnd_x2, SecondEnd_y2);

		FlushBatchDraw();

		Sleep(50);
		setcolor(BLACK);
		line(center_x, center_y, SecondEnd_x, SecondEnd_y);
		setcolor(BLACK);
		line(center_x, center_y, SecondEnd_x1, SecondEnd_y1);
		setcolor(BLACK);
		line(center_x, center_y, SecondEnd_x2, SecondEnd_y2);

	//	SecondAngel = SecondAngel + 2 * Pi / 60;
	}
	EndBatchDraw();
	_getch();
	closegraph();
	return 0;
}